package com.limin.commanser.service.impl;

import com.limin.commanser.dto.ExpenseDto;
import com.limin.commanser.entity.Expense;
import com.limin.commanser.mapper.ExpenseMapper;
import com.limin.commanser.service.ExpenseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ExpenseServiceImpl implements ExpenseService {
    private final ExpenseMapper expenseMapper;

    @Autowired
    ExpenseServiceImpl(ExpenseMapper expenseMapper) {
        this.expenseMapper = expenseMapper;
    }

    @Override
    public List<ExpenseDto> findAllByPaging(Integer userId) {
        return expenseMapper.findAllByPaging(userId);
    }

    @Override
    public List<ExpenseDto> findAllByPagingAll(Map<Object, Object> params) {
        return expenseMapper.findAllByPagingAll(params);
    }

    @Override
    public Integer findTotal() {
        return expenseMapper.findTotal();
    }

    @Override
    public void add(Expense expense) {
        expenseMapper.add(expense);
    }

    @Override
    public void approvalExpense(Expense expense) {
        expenseMapper.approvalExpense(expense);
    }

    @Override
    public void removeById(Integer id) {
        expenseMapper.removeById(id);
    }

    @Override
    public void update(Expense expense) {
        expenseMapper.update(expense);
    }

    @Override
    public Integer batchDeleteById(String[] ids) {
        return expenseMapper.batchDeleteById(ids);
    }

    @Override
    public List<ExpenseDto> findAllByLike(String string) {
        return expenseMapper.findAllByLike(string);
    }
}
